package com.ssy.lingxi.scheduler.api.model;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PositiveOrZero;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 创建永久定时任务接口参数
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-12
 */
public class PermanentTaskVO implements Serializable {
    private static final long serialVersionUID = -5706894035161400677L;

    /**
     * 调用方定义的任务名称，全局唯一
     */
    @NotBlank(message = "任务名称不能为空")
    @Size(max = 100, message = "任务名称最长100个字符")
    private String taskName;

    /**
     * 创建定时任务的服务名称，例如order-service
     */
    @NotBlank(message = "服务名称不能为空")
    @Size(max = 100, message = "服务名称最长100个字符")
    private String serviceName;

    /**
     * 定时任务执行后，调用方提供的回调接口Url
     */
    @NotBlank(message = "回调接口Url不能为空")
    @Size(message = "回调接口Url最长200个字符")
    private String callbackUrl;

    /**
     * 任务执行时间，次日 00:00 之后的分钟数，例如要在凌晨01:30执行，此参数值为 90
     */
    @NotNull(message = "任务执行时间要大于等于0")
    @PositiveOrZero(message = "任务执行时间要大于等于0")
    private Integer startMinutes;

    /**
     * 任务每次执行间隔时间，单位：分钟。如不填则默认为1440分钟，即 24小时
     */
    private Integer intervalMinutes;

    /**
     * 是否删除旧定时器，创建新的，非必填，默认值为true
     */
    private Boolean isCreateNew = true;

    /**
     * 会员Id，非必填，如不填则在回调通知中返回为0
     */
    private Long memberId;

    /**
     * 会员角色Id，非必填，如不填则在回调通知中返回0
     */
    private Long roleId;

    /**
     * 定时任务的参数，例如订单Id等，非必填，如为空则在回调通知中返回空
     */
    private List<Long> dataIds;

    /**
     * 定时任务的自定义属性，回调通知中原样返回
     */
    private Map<String, Object> taskAttributes;

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getCallbackUrl() {
        return callbackUrl;
    }

    public void setCallbackUrl(String callbackUrl) {
        this.callbackUrl = callbackUrl;
    }

    public Integer getStartMinutes() {
        return startMinutes;
    }

    public void setStartMinutes(Integer startMinutes) {
        this.startMinutes = startMinutes;
    }

    public Integer getIntervalMinutes() {
        return intervalMinutes;
    }

    public void setIntervalMinutes(Integer intervalMinutes) {
        this.intervalMinutes = intervalMinutes;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public List<Long> getDataIds() {
        return dataIds;
    }

    public void setDataIds(List<Long> dataIds) {
        this.dataIds = dataIds;
    }

    public Map<String, Object> getTaskAttributes() {
        return taskAttributes;
    }

    public void setTaskAttributes(Map<String, Object> taskAttributes) {
        this.taskAttributes = taskAttributes;
    }

    public Boolean getIsCreateNew() {
        return isCreateNew;
    }

    public void setIsCreateNew(Boolean isCreateNew) {
        isCreateNew = isCreateNew;
    }
}
